import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hotpot/basic/app_colors.dart';
import 'package:hotpot/pages/order/widgets/confirma_pin_widget.dart';
import 'package:hotpot/route/route_ext.dart';
import 'package:hotpot/utils/time_utils.dart';
import 'package:hotpot/utils/user_utils.dart';
import 'package:hotpot/widgets/styles/icon_box.dart';
import 'package:hotpot/widgets/widget_ext.dart';
import 'package:hotpot/widgets/z_container.dart';
import 'package:hotpot/widgets/z_image.dart';

class LockPage extends StatefulWidget {
  const LockPage({super.key});

  @override
  State<LockPage> createState() => _LockPageState();
}

class _LockPageState extends State<LockPage> {
  var showPin = false.obs;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    TimeUtils.stop();
  }

  @override
  void dispose() {
    // TODO: implement dispose
    TimeUtils.exitStop();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.baColor,
      body: Stack(
        children: [
          Column(
            children: [
              41.hSizedBox,
              ZImage.memory(bytes: UserUtils.companyImg, width: 95, height: 95, radius: 100),
              37.hSizedBox,
              UserUtils.companyName.text(color: Colors.black, size: 24, bold: true),
              const SizedBox().expanded(),
              const ZContainer(
                alignment: Alignment.center,
                width: 94,
                height: 35,
                color: Color(0xFF22CE67),
                radius: 18,
                child: IconBox(Icons.lock_outlined, 11, 11, bgColor: Colors.transparent),
              ).gestureDetector(onTap: () => showPin.value = true),
              51.hSizedBox,
            ],
          ).positioned(left: 0, right: 0, top: 0, bottom: 0),
          Obx(
            () => ConfirmaPinWidget(
              () => showPin.value = false,
              (id) => pop(),
            ).visibility(showPin.value).positioned(left: 0, right: 0, top: 0, bottom: 0),
          ),
        ],
      ),
    );
  }
}
